import { ConfigProvider } from 'antd'
import zhCN from 'antd/locale/zh_CN'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore'
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter'

import { WorkTimeProvider } from './contexts/WorkTimeContext'
import MainLayout from './components/Layout/MainLayout'
import HomePage from './page/HomePage'

// 扩展 dayjs 插件
dayjs.extend(isSameOrBefore)
dayjs.extend(isSameOrAfter)

// 配置dayjs中文locale
dayjs.locale('zh-cn')

function App() {
  return (
    <ConfigProvider locale={zhCN}>
      <WorkTimeProvider>
        <MainLayout>
          <HomePage />
        </MainLayout>
      </WorkTimeProvider>
    </ConfigProvider>
  )
}

export default App
